<style>
	body{
		background: #f5f5f5;
	}
</style>
<div class="sectionY">
	<a href="javascript:history.back()">
		<img src="__PUBLIC__/home/images/a4.png" class="a1" alt="">
	</a>
	<p class="p1">团队奖</p>
	<a href="{:url('atcChange')}" class="a3">兑换资产</a>
</div>
<div class="kong1"></div>
<div class="com_section1">
	<div class="com_section1_1">
		<p class="p1">团队奖</p>
		<p class="p2">{$userinfo.wagesall}</p>
	</div>
</div>
<div class="com_section2">
	<div class="title">
		<p class="p1">团队奖明细</p>
	</div>
	<div class="center content">
		<div class="content1"></div>
	</div>
</div>

<script>
	var params = {
		page: 0,
		page_size: 10,
	};
	var mm;
	$(function () {
		// dropload
		mm = $('.content').dropload({
			scrollArea: window,
			domUp: {
				domClass: 'dropload-up',
				domRefresh: '<div class="dropload-refresh" style="color: #ccc">↓下拉刷新</div>',
				domUpdate: '<div class="dropload-update" style="color: #ccc">↑释放更新</div>',
				domLoad: '<div class="dropload-load" style="color: #ccc"><span class="loading"></span>加载中</div>'
			},
			domDown: {
				domClass: 'dropload-down',
				domRefresh: '<div class="dropload-refresh" style="color: #ccc">↑上拉加载更多</div>',
				domLoad: '<div class="dropload-load" style="color: #ccc"><span class="loading"></span>加载中</div>',
				domNoData: '<div class="dropload-noData" style="color: #ccc">暂无更多数据</div>'
			},
			loadUpFn: function (me) {
				params.page = 1;
				var _html = '';
				$.ajax({
					url: '{:url(\'User/ajaxmoreatc\')}',
					data: params,
					dataType: "JSON",
					type: "POST",
					success: function (res) {
						var data = res;
						if (data.length > 0) {
							_html = formatList(data);
						}
						$('.content1').html(_html);
						// 每次数据加载完，必须重置
						me.resetload();
						// 重置页数，重新获取loadDownFn的数据
						page = 1;
						// 解锁loadDownFn里锁定的情况
						me.unlock();
						me.noData(false);
					},
					error: function (res) {
						alert(res);
					}
				})
			},
			loadDownFn: function (me) {
				params.page++;
				var _html = '';
				$.ajax({
					url: '{:url(\'User/ajaxmoreatc\')}',
					data: params,
					dataType: "JSON",
					type: "POST",
					success: function (res) {
						var data = res;
						if (data.length > 0) {
							_html = formatList(data);
						} else {
							// 锁定
							me.lock();
							// 无数据
							me.noData();
						}
						// 插入数据到页面，放到最后面
						$('.content1').append(_html);
						// 每次数据插入，必须重置
						me.resetload();
					},
					error: function (res) {
						alert(res);
					}
				})
			},
			threshold: 50
		});
	});

	function formatList(data) {
		var _html = '';
		$.each(data, function (i, v) {
			_html += '<div class="list clearfix">\n' +
					'            <div class="a1 clearfix">\n';
			if(v.isadd == 1){
				_html += '                <p class="p1">+'+v.nums+'</p>\n';
			}else{
				_html += '                <p class="p1">-'+v.nums+'</p>\n';
			}
			_html += '                <p class="p2">'+v.ctime+'</p>\n' +
					'            </div>\n' +
					'            <div class="a2">\n' +
					'                <p class="p1">'+v.info+'</p>\n' +
					'            </div>\n' +
					'        </div>';
		})
		return _html;
	}
</script>